/**
 * Created by ruiyuan on 15-10-8.
 */

var taskService = require('../services/taskService');
var messageUtil = require('../common/utils/messageUtil');
var toolUtil = require('../common/utils/toolUtil');
var Users = mongoose.model('user');
var async = require('async');
var md5 = require('MD5');
var moment = require('moment');


/**
 * 新手任务详情
 * @param req
 * @param res
 */
exports.getNoviceTaskDetail = function (req, res) {
    var user = req.user;

    taskService.getNoviceTaskDetailService(user, function (err, result) {
        if (err) {
            logger.error('Failed to getNoviceTaskDetail ---' + err.message);
            res.json(messageUtil.composeFailedMessage(req, err.message, 6009));
        } else {
            res.json(messageUtil.composeSucceededMessage(req, null, result, 6009));
        }
    })
};
/*  宝宝树66小区二次改造    add   chenf  20170721   start   */
exports.getFinishTask = function (req, res) {
    taskService.finishTaskService(req.user._id, "share", function (err, result) {
        if (err) {
            logger.error('Failed to getNoviceTaskDetail ---' + err.message);
            res.json(messageUtil.composeFailedMessage(req, err.message, 6009));
        } else {
            res.json(messageUtil.composeSucceededMessage(req, null, result, 6009));
        }
    })
};
/*  宝宝树66小区二次改造    add   chenf  20170721   end   */